<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>严重质量问题台账列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body class="listBody">
<div class="qbdms-list">
    <div class="layui-table-view-body">
        <table id="seriousFalProblemTable" lay-filter="seriousFalProblemTable"></table>
    </div>
</div>
<!-- 列表头部工具栏 -->
<script type="text/html" id="seriousFalProblemHeaderToolsBar">
    <div class="ccpui-enterSel">
        <div class="layui-btn-container">
            <a class="layui-btn layui-btn-sm" lay-event="export">
                <span>导出</span>
            </a> 
        </div>
        <form class="layui-form" action="" lay-filter="seriousFalProblemQueryForm">
            <div class="layui-form-body selch">
                <div class="table-top-filter layui-row">
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">质量问题名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fProblemname_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">问题等级</label>
                        <div class="layui-input-block">
                            <select name="Q_fProblemrank_S" class="layui-input filter-value" placeholder="请输入">
                                <option value=""></option>
                            </select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">问题责任单位</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fDutydept_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">问题发生时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input start_time1 filter-value" name="Q_beginTime_DL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">问题发生时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input end_time1 filter-value" name="Q_endTime_DG" placeholder="请输入"/>
                        </div>
                    </div>
                </div>
                <div class="selchBtn">
                    <a class="layui-btn layui-btn-sm fillBtn" lay-event="query">
                        <span>查询</span>
                    </a>
                    <div class="layui-btn-group">
                        <button type="button" class="layui-btn layui-btn-sm" lay-event="clears" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_refresh"></i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm screenParent" lay-event="screen" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_downarrow screen"></i>
                        </button>
                    </div>
                </div>
            </div>
        </form >
    </div>
</script>
<!-- 右侧工具栏 -->
<script type="text/html" id="seriousFalProblemRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table', 'common','publicMethods','jquery','layer','propsHandle'], function () {
        var table = layui.table;
        var common = layui.common;
        var $ = layui.jquery;
        var layer = layui.layer;
        var publicMethods=layui.publicMethods;
        var tableH=publicMethods.tabHeight();
        var propsHandle = layui.propsHandle;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });

        function initQueryCol() {
            var wtdjDic = eval('${wtdjDic}'); //问题等级
            common.initDicData("Q_fProblemrank_S", wtdjDic);
        }
        //第一个实例
        table.render({
            elem: '#seriousFalProblemTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/seriousFalProblem/list'
            ,page: true //开启分页
            ,limit: 20
            ,toolbar: '#seriousFalProblemHeaderToolsBar'
            ,method: 'post'
            ,defaultToolbar: ['']
            ,autoSort: false //是否排序
            ,cols: [[ //表头
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                ,{field: 'fProblemname', title: '问题/事件名称',sort:false, sortname: 'f_problemname',minWidth:'150'}
                ,{field: 'fModelsymbol', title: '装备名称',sort:false, sortname: 'f_modelsymbol',minWidth:'150'}
                ,{field: 'fDetecttime', title: '发生时间',sort:false, sortname: 'f_detecttime',minWidth:'130',templet: function (d) {
                        return publicMethods.timeData(d.fDetecttime);
                    }}
                ,{field: 'fFailuredescription', title: '问题/事故发生过程及现象',sort:false, sortname: 'f_failuredescription',minWidth:'200'}
                ,{field: 'fCausation', title: '原因分析',sort:false, sortname: 'f_deepreason',minWidth:'150'}
                ,{field: 'fCausationclass1', title: '原因分类',sort:false, sortname: 'f_causationclass1',minWidth:'130'}
                ,{field: 'fCorrectmeasure', title: '处理措施',sort:false, sortname: 'f_correctmeasure',minWidth:'150'}
                ,{field: 'fDutydept', title: '责任单位',sort:false, sortname: 'f_dutydept',minWidth:'150'}
                ,{field: 'fResettype', title: '归零情况',sort:false, sortname: 'f_resettype',minWidth:'150'}
                ,{field: 'fProblemrank', title: '问题等级',sort:false, sortname: 'f_problemrank',minWidth:'130'}
                ,{field: 'fBreakphase', title: '生命周期所处阶段',sort:false, sortname: 'f_breakphase',minWidth:'150'}
                ,{
                    fixed: 'right',
                    title: '管理',
                    toolbar: '#seriousFalProblemRightToolsBar',minWidth:'130'
                }
            ]],done:function () {
                dateReflash();
                table.resize("seriousFalProblemTable");
                common.tableSelectCon('.ccpui-enterSel .layui-form input','a[lay-event=query]','.ccpui-enterSel');
            }
        });

        function dateReflash() {
            publicMethods.reflashDate({startName:'.start_time1',endName:'.end_time1'});
        }

        function reflashQuery(isClear) {
            common.tableConditionRender("seriousFalProblemTable","seriousFalProblemQueryForm",{where:{}},isClear, false, 20);
        }
        

        table.on('toolbar(seriousFalProblemTable)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            var _this = this;
            switch (obj.event) {
                case 'export':
                function open(url , param){
                    var curUrl = url;
                    layer.open({
                        type: 2,
                        area: ['700px', '520px'],
                        title: ['自定义导出', 'font-size:14px;'],
                        content: serverPath.qbdmsPath + '/qbdms/seriousFalProblem/view/export',
                        btnAlign: 'c',
                        skin: 'qbdms-layerFormBtn',
                        btn: ['确定', '取消'],
                        yes: function(index, layero){
                            url = curUrl;
                            var iframeWin = window["layui-layer-iframe" + index];
                            var data = iframeWin.getData();
                            if(data){
                                url = url + "?data=" + JSON.stringify(data) + param;
                                window.location.href = encodeURI(url)
                            }
                        }
                    });
                }
                    if (data.length == 0) {
                        layer.confirm(publicMethods.confirmStyle('还没有选择，是否导出全部？'),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var url = serverPath.qbdmsPath + '/qbdms/seriousFalProblem/exportData';
                            var param = "";
                            $("form[lay-filter='seriousFalProblemQueryForm']").find(".filter-value").each(function(i,value) {
                                param += "&"+this.name+"="+this.value
                            });
                            open(url , param);
                        });
                    } else {
                        layer.confirm(publicMethods.confirmStyle('确定导出吗？'),{title: false,skin: 'confirm-class'},function (index) {
                            layer.close(index);
                            var ids = [];
                            for (var i = 0; i < data.length; i++) {
                                ids.push(data[i].id);
                            }
                            var url = serverPath.qbdmsPath + '/qbdms/seriousFalProblem/exportData';
                            open(url , "&id="+ids);
                        });
                    }
                    break;
                case "query":
                    reflashQuery(false);
                    dateReflash();
                    initQueryCol();
                    break;
                case "clears":
                    reflashQuery(true);
                    dateReflash();
                    break;
                case "screen":
                    common.initScreenTop('unZeroTable');
                    form.render();
                    break;
            };
        });

        table.on('tool(seriousFalProblemTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "particulars":
                    window.location.href =  serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/particulars?id='+data.id
                    +'&backUrl=/qbdms/seriousFalProblem/view/list'
                    break;
            }
        });

        initQueryCol();

        window.Initialization = function () {
            reflashQuery(false);
            dateReflash();
        };

        //list页面初始化展开按钮tips展示（展开按钮类名）
        publicMethods.tipsAuto('.screen')
        //筛选条件初始化（页面表格的Id，是否初始化（true、false））
        common.initScreenTop('seriousFalProblemTable',true);
    });
</script>
</body>
</html>